import axios from "./request";

// 获取文章分页
export const getArticles = (params) => {
    return axios({
        url: "/article/page",
        method: "GET",
        params: params
    })
}

// 获取文章列表
export const getArticleList = () => {
    return axios({
        url: "/article/list",
        method: "GET"
    })
}

// 通过id获取文章
export const getArticleById = (params) => {
    return axios({
        url: "/article/" + params,
        method: "GET"
    })
}

// 通过id删除文章
export const deleteArticleById = (params) => {
    return axios({
        url: "/article/" + params,
        method: "DELETE"
    })
}

// 批量删除文章
export const deleteArticleByIds = (params) => {
    return axios({
        url: "/article/batch",
        method: "DELETE",
        data: params
    })
}

// 修改文章
export const editArticle = (params) => {
    return axios({
        url: "/article/",
        method: "PUT",
        data: params
    })
}

// 添加文章
export const addArticle = (params) => {
    return axios({
        url: "/article/",
        method: "POST",
        data: params
    })
}
